﻿using System;
using System.Windows;
using MyFloridaHouse.ServiceConn.DistrBldrSvcRef;

namespace MyFloridaHouse.libSvOpenDistricts.DataService
{
    public partial class ServiceDAL
    {

        private int _getACSDistrictDataSummaryRequestCount = 0;
        public int getACSDistrictDataSummaryRequestCount
        {
            get { return _getACSDistrictDataSummaryRequestCount; }
            set { if (_getACSDistrictDataSummaryRequestCount != value) { _getDistrictDataSummaryRequestCount = value; NotifyPropertyChanged("getACSDistrictDataSummaryRequestCount"); } }
        }


        public void GetACSDistrictDataSummary(int districtID, byte[] compressedRegionIDList, string sourceLayerID, string tableIDList, System.EventHandler<GetACSDistrictDataSummaryCompletedEventArgs> completedHandler)
        {
            try
            {
            	//var proxy = new MyDistrictBuilderServiceClient(myRelativeBinding, myRelativeCensusDataServiceAddress);
				var proxy = new DistrBldrClient(_relativeBindingName);
                proxy.GetACSDistrictDataSummaryCompleted += completedHandler;
                //TODO: Should shapeUogIDList be compressed like it is in GetDistrictShape?
                proxy.GetACSDistrictDataSummaryAsync(districtID, compressedRegionIDList, sourceLayerID, tableIDList);
                getACSDistrictDataSummaryRequestCount++;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}
